<?php
// -----------------------------------------------------------------------------
// include
// -----------------------------------------------------------------------------

include "../config/config.php";
include "../auth.php";
include "../DBManager.php";

// -----------------------------------------------------------------------------
// 访问设置
// -----------------------------------------------------------------------------

if (!isset($_GET["categoryId"])) {
    exit("需要传入有效的参数！");
}

$categoryId = $_GET["categoryId"];

// -----------------------------------------------------------------------------
// 数据库相关设置
// -----------------------------------------------------------------------------

$dbPath = "../" . $dbPath;
$db = new DBManager("sqlite:" . $dbPath);

// -----------------------------------------------------------------------------

$links = $db->getListOfLinksInCategory($categoryId, "sortNumber");

echo "<div class='list-group'>";
foreach ($links as $link) {

    $title = $link["title"];
    $sortNumber = $link["sortNumber"];

    echo <<<BBB
        <span role="button" 
              data-sortnumber="$sortNumber" 
              class='list-group-item list-group-item-action selectAsTarget text-break'>$title</span>
    BBB;

}
echo "</div>";
